import {queryOrgList, queryTreeOrgList,} from '@/services/system/sysRole';


export default {
  namespace: 'orgSelectModel',
  state: {
    //组织树
    orgTree: [],
  },


  effects: {

    * queryOrgTree({payload}, {call, put}) {
      const response = yield call(queryTreeOrgList, payload);
      if (response.result == 'fail') {
        return;
      }
      yield put({
        type: 'saveOrgTree',
        payload: response,
      });

    },

  },

  reducers: {

    saveOrgTree(state, action) {
      return {
        ...state,
        orgTree: action.payload.data,
      };
    },

  },
};
